/*
 * Copyright 2020-2021 redragon.dongbin
 *
 * This file is part of redragon-erp/赤龙ERP.

 * redragon-erp/赤龙ERP is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.

 * redragon-erp/赤龙ERP is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with redragon-erp/赤龙ERP.  If not, see <https://www.gnu.org/licenses/>.
 */
package com.erp.order.poa.dao.model;

import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

@Data
@MappedSuperclass
public class PoAgreementLineBase {

    //Constructors
    public PoAgreementLineBase() {
    }
    
    //Fields
    
    //合同补充id
    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    @Column(name = "po_line_id", unique = true, nullable = false)
    private Integer poLineId;

    // 合同名称
    @NotBlank(message="{name.NotBlank}")
    @Column(name = "po_name" )
    private String poName;

    //合同编码
    @NotBlank(message="合同编码不能为空")
    @Column(name = "po_head_code", unique = false, nullable = false, length = 45)
    private String poHeadCode;

    //补充条款描述
    @Column(name = "memo", unique = false, nullable = true, length = 500)
    private String memo;


    //状态
    @Column(name = "status", unique = false, nullable = false, length = 10)
    private String status;

    // 审批状态（未提交UNSUBMIT、待审批SUBMIT、审批中APPROVE、已驳回REJECT、审批完结COMPLETE）
    @Column(name = "approve_status" )
    private String approveStatus;

    //创建时间
    @Column(name = "created_date", unique = false, nullable = false)
    private Date createdDate;

    //创建人
    @Column(name = "created_by", unique = false, nullable = false, length = 45)
    private String createdBy;

    //最后修改时间
    @Column(name = "last_updated_date", unique = false, nullable = true)
    private Date lastUpdatedDate;

    //最后修改人
    @Column(name = "last_updated_by", unique = false, nullable = true, length = 45)
    private String lastUpdatedBy;

    //附件地址
    @Column(name = "file_url", unique = false, nullable = true, length = 255)
    private String fileUrl;

    //合同补充流程实例id
    @Column(name = "process_instance_id", unique = false, nullable = true, length = 64)
    private String processInstanceId;

    /*
     * 用于展示的字段
     */
    // 签订单位
    @Transient
    private String vendorCode;

    // 发起单位
    @Transient
    private String sponsorCode;

    // 实施站点
    @Transient
    private String orgCode;

    // 实施部门
    @Transient
    private String departmentCode;
    //开始日期
    @Transient
    private String startDate;
    //终止日期
    @Transient
    private String endDate;


}